package gr.aueb.cs.mscis.chordroid.app;

public class FileDescriptor extends FileChunk {

	private static final long serialVersionUID = 1L;
	private int numOfReplicas = 1;
	private int fileChunkSize = 1024*50;
	private int fileSize = 0;
	private String synopsis;

	public FileDescriptor(String hash, int totalSize, String synopsis) {
		super(hash);
		this.setFileSize(totalSize);
		this.setSynopsis(synopsis);
	}

	public void setNumOfReplicas(int numOfReplicas) {
		this.numOfReplicas = numOfReplicas;
	}

	public int getNumOfReplicas() {
		return numOfReplicas;
	}

	public void setFileSize(int totalSize) {
		this.fileSize = totalSize;
	}

	public int getFileSize() {
		return fileSize;
	}

	public void setSynopsis(String synopsis) {
		this.synopsis = synopsis;
	}

	public String getSynopsis() {
		return synopsis;
	}

	public void setFileChunkSize(int fileChunkSize) {
		this.fileChunkSize = fileChunkSize;
	}

	public int getFileChunkSize() {
		return fileChunkSize;
	}
	
	public int getNumberOfFileChunks() {
		return (fileSize % fileChunkSize == 0) ? fileSize/fileChunkSize : (fileSize/fileChunkSize) + 1;
	}
}
